home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
LANG
/
C
/
LIB
/
UNIXLIB37B
/
!UnixLib37
/
src
/
unix
/
c
/
utime
< prev
next >
Wrap
Text File
|
1996-11-09
|
1KB
|
62 lines
/****************************************************************************
*
* $Source: /unixb/home/unixlib/source/unixlib37/src/unix/c/RCS/utime,v $
* $Date: 1996/10/30 22:04:51 $
* $Revision: 1.2 $
* $State: Rel $
* $Author: unixlib $
*
* $Log: utime,v $
* Revision 1.2 1996/10/30 22:04:51 unixlib
* Massive changes made by Nick Burret and Peter Burwood.
*
* Revision 1.1 1996/04/19 21:35:27 simon
* Initial revision
*
***************************************************************************/
static const char rcs_id[] = "$Id: utime,v 1.2 1996/10/30 22:04:51 unixlib Rel $";
#include <errno.h>
#include <time.h>
#include <unistd.h>
#include <utime.h>
#include <sys/os.h>
int
utime (const char *filename, const struct utimbuf *times)
{
int r[6];
char *file;
_kernel_oserror *e;
time_t t;
file = __uname ((char *)filename, 0);
if (e = os_file (0x05, file, r))
{
__seterr (e);
return -1;
}
if (!r[0])
{
errno = ENOENT;
return -1;
}
/* If times is null then get the current time. */
t = (times) ? times->modtime : time (0);
r[2] = (r[2] & 0x000fff00U) | 0xfff00000U |
((((t >> 8) * 100) >> 24) + 0x33);
r[3] = t * 100 + 0x6e996a00U;
if (e = os_file (0x01, file, r))
{
__seterr (e);
return -1;
}
return 0;
}